package com.pointlion.sys.mvc.common.model;

import com.jfinal.aop.Before;
import com.jfinal.plugin.activerecord.tx.Tx;
import com.pointlion.sys.mvc.common.model.base.BasePaper;

import java.util.List;

@SuppressWarnings("serial")
public class Paper extends BasePaper<Paper> {
	public static final Paper dao = new Paper();
	public static final String tableName = "paper";
	
	/***
	 * ����������ѯ
	 */
	public Paper getById(String id){
		return Paper.dao.findById(id);
	}
	
	/***
	 * ɾ��
	 * @param ids
	 */
	@Before(Tx.class)
	public void deleteByIds(String ids){
    	String idarr[] = ids.split(",");
    	for(String id : idarr){
    		Paper o = Paper.dao.getById(id);
    		o.delete();
    	}
	}

    public List<Paper> getDataByPaperid(String paperid) {
		String sql = "select * from paper_item where paper_id = '"+paperid+"' ";
		return Paper.dao.find(sql);
    }
}